package servlet1;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;


//退出登录
@WebServlet("/loginOut")
public class loginOut extends HttpServlet {


    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        // 删除用户TOKEN
        Cookie cookie = new Cookie("TOKEN", "");
        cookie.setMaxAge(0);
        resp.addCookie(cookie);

        resp.sendRedirect("login.jsp");


    }
}
